<template>
  <div class="home">
    <van-swipe class="my-swiper" :autoplay="3000" indicator-color="white">
      <van-swipe-item v-for="item in lunbolist" :key="item.id">
        <img v-lazy="item.img" alt="" />
      </van-swipe-item>
    </van-swipe>
    <van-grid :column-num="3">
      <van-grid-item
        v-for="grid in grids"
        :key="grid.id"
        :icon="grid.src"
        :text="grid.title"
        :to="grid.to"
      />
    </van-grid>
  </div>
</template>
<script>
export default {
  data() {
    return {
      lunbolist: [],
      grids: [],
    };
  },
  created() {
    this.getLunbo();
    this.getGrids();
  },
  methods: {
    async getLunbo() {
      const res = await this.$http.getLunbo();
      this.lunbolist = res.data.message;
    },
    async getGrids() {
      const res = await this.$http.getGrids();
      this.grids = res.data.message;
    },
  },
};
</script>
<style lang="scss" scoped>
.home {
  .my-swiper {
    height: 200px;
    img {
      width: 100%;
      height: 100%;
    }
  }
  .van-grid-item_icon {
    font-size: 60px;
  }
}
</style>
